let res = arrayRankTransform([37,12,28,9,100,56,80,5,12])
console.log(res);
function arrayRankTransform(arr) {
    let newArr = [...arr]
    arr.sort((a,b) => a - b)

    let hashObj = {},
    count = 1,
    indexArr = []
   for (let i = 0; i < arr.length; i++) {
    if (!hashObj[arr[i]]) {
        hashObj[arr[i]] = count++
    }
   }

  for (let i = 0; i < newArr.length; i++) {
    indexArr.push(hashObj[newArr[i]])
  }
  return indexArr
}

let a = {
  v: 1,
  valueOf() {
    return 10
  },
  toString() {
    return 1
  }
}

let b = {

}

let Arr = []

for (let i = 0; i < array.length; i++) {
  
  
}